package models

import (
	"gorm.io/driver/mysql"
	"gorm.io/gorm"
)

type Shop struct {
	gorm.Model
	Name  string
	Price float64
	Kg    float64
	Num   int
}

var DB *gorm.DB

func Init() {
	dsn := "root:123456@tcp(127.0.0.1:3306)/lx?charset=utf8&parseTime=True&loc=Local"
	var err error
	DB, err = gorm.Open(mysql.Open(dsn))
	if err != nil {
		panic(err)
	}
	DB.AutoMigrate(&Shop{})
}
